///**
// * Project Name:spring-cloud-pilot File Name:ClassPathFileChangeListener.java Package
// * Name:org.spring.cloud.pilot.listener Date:2019年10月21日上午9:40:33 Copyright (c) 2019, dengqian37@126.com All Rights
// * Reserved.
// *
// */
//
//package org.spring.cloud.pilot.listener;
//
//import java.util.Set;
//
//import org.spring.cloud.pilot.event.ClassPathChangedEvent;
//import org.spring.cloud.pilot.filewatch.ChangedFile;
//import org.spring.cloud.pilot.filewatch.ChangedFiles;
//import org.spring.cloud.pilot.filewatch.FileChangeListener;
//import org.spring.cloud.pilot.filewatch.FileSystemWatcher;
//import org.springframework.context.ApplicationEventPublisher;
//import org.springframework.util.Assert;
//
///**
// * ClassName:ClassPathFileChangeListener <br/>
// * Function: TODO ADD FUNCTION. <br/>
// * Reason: TODO ADD REASON. <br/>
// * Date: 2019年10月21日 上午9:40:33 <br/>
// * 
// * @author dengqian
// * @version
// * @since JDK 1.8
// * @see
// */
//public class ClassPathFileChangeListener implements FileChangeListener {
//
//    private final ApplicationEventPublisher eventPublisher;
//
//
//    private final FileSystemWatcher fileSystemWatcherToStop;
//
//    /**
//     * Create a new {@link ClassPathFileChangeListener} instance.
//     * 
//     * @param eventPublisher the event publisher used send events
//     * @param restartStrategy the restart strategy to use
//     * @param fileSystemWatcherToStop the file system watcher to stop on a restart (or {@code null})
//     */
//    ClassPathFileChangeListener(ApplicationEventPublisher eventPublisher, 
//        FileSystemWatcher fileSystemWatcherToStop) {
//        Assert.notNull(eventPublisher, "EventPublisher must not be null");
////        Assert.notNull(restartStrategy, "RestartStrategy must not be null");
//        this.eventPublisher = eventPublisher;
//        this.fileSystemWatcherToStop = fileSystemWatcherToStop;
//    }
//
//    @Override
//    public void onChange(Set<ChangedFiles> changeSet) {
//        boolean restart = isRestartRequired(changeSet);
//        publishEvent(new ClassPathChangedEvent(this, changeSet, restart));
//    }
//
//    private void publishEvent(ClassPathChangedEvent event) {
//        this.eventPublisher.publishEvent(event);
//        if (event.isRestartRequired() && this.fileSystemWatcherToStop != null) {
//            this.fileSystemWatcherToStop.stop();
//        }
//    }
//
//    private boolean isRestartRequired(Set<ChangedFiles> changeSet) {
////        if (AgentReloader.isActive()) {
////            return false;
////        }
////        for (ChangedFiles changedFiles : changeSet) {
////            for (ChangedFile changedFile : changedFiles) {
////                if (this.restartStrategy.isRestartRequired(changedFile)) {
////                    return true;
////                }
////            }
////        }
//        return false;
//    }
//
//}
